<?php
/**
 * Created by PhpStorm.
 * User: eddie
 * Date: 2018/5/10
 * Time: 上午2:48
 */

namespace App\Jobs;

use Symfony\Component\HttpKernel\Exception\HttpException;

trait Helper
{
    public static function throwException($message = null, $statusCode = 422, $code = 0)
    {

        if (is_null($message)) {
            $message = trans('error.' . $code) ? trans('error.' . $code) : trans('error.undefined');
        }

        throw new HttpException($statusCode, $message, null, [], $code);

    }
}